# Maintainer: Antonio Rojas <arojas@archlinux.org>
# Contributor: Ashwin Vishnu <ashwinvis+arch at pr0t0nm4il dot com>
# Contributor: Specter119 <specter119 AT gmail DOT com>
# Contributor: xantares

pkgname=python-ipyparallel
_pyname=${pkgname#python-}
pkgver=8.6.1
pkgrel=2
pkgdesc='Interactive Parallel Computing in Python'
url='https://pypi.org/project/ipyparallel/'
arch=(any)
license=(BSD)
source=(https://files.pythonhosted.org/packages/source/${_pyname::1}/$_pyname/$_pyname-$pkgver.tar.gz)
depends=(jupyterlab python-psutil)
makedepends=(python-build python-installer python-hatchling)
checkdepends=(python-pytest-tornado python-pytest-asyncio python-tqdm)
optdepends=('openmpi: to use the MPI Launchers in ipcluster command')
sha256sums=('a39aa5ef9560170bf0e9afedca9ff045e1b9c1832c49303377edcc91cea9fb77')

build() {
  cd $_pyname-$pkgver
  IPP_DISABLE_JS=1 \
  python -m build --wheel --no-isolation --skip-dependency-check
}

check() {
  cd $_pyname-$pkgver
  python -m installer --destdir=test_install dist/*.whl
  PYTHONPATH="$PWD"/test_install/`python -c "from sysconfig import get_path; print(get_path('platlib'))"` \
  pytest -v -k 'not test_local_ip_true_doesnt_trigger_warning' -W ignore::DeprecationWarning
}

package() {
  cd $_pyname-$pkgver
  python -m installer --destdir="$pkgdir" dist/*.whl
  install -Dm644 COPYING.md "$pkgdir"/usr/share/licenses/$pkgname/LICENSE
  mv "$pkgdir"/{usr/,}etc
}
